using Unity.Mathematics;
using UnityEngine;

public class ThownObject : MonoBehaviour
{
	public Collider2D col;

	public Rigidbody2D rigidBody;

	public GameObject gameObjectForContact;

	public float delay;

	public bool activated;

	public float thownForce;

	public float destroyTime;

	public float destoryAfter = 10f;

	public bool pickupable;

	private void Awake()
	{
		if (destoryAfter > 0f)
		{
			Object.Destroy(base.gameObject, destoryAfter);
		}
		if (rigidBody == null)
		{
			rigidBody = GetComponent<Rigidbody2D>();
		}
	}

	private void OnCollisionEnter2D(Collision2D collision)
	{
		if (!activated)
		{
			Invoke("Active", delay);
			activated = true;
		}
	}

	public void Active()
	{
		if ((bool)gameObjectForContact)
		{
			Object.Instantiate(gameObjectForContact, base.transform.position, quaternion.identity).SetActive(value: true);
			Object.Destroy(base.gameObject, destroyTime);
		}
	}
}
